<?php
session_start();
include 'dbconnection.php';
if(isset($_POST['submit'])) {
	if(!empty($_POST['username']) && !empty($_POST['password'])) {
	$encryptPassword = md5($_POST['password']);
			 $adminQry = "SELECT *
					 FROM `admin`
					 WHERE `adminUsername` = '".$_POST['username']."'
					 AND `adminpassword` = '".$encryptPassword."'";
			$adminExe = mysql_query($adminQry);
			if(mysql_num_rows($adminExe) == 0) {
				header('Location:index.php?msg=2');
			} else {
				$adminRow = mysql_fetch_array($adminExe);
				$_SESSION['PCUN'] = $_POST['username'];
				$_SESSION['PCID'] = $adminRow['adminId'];
										
				header('Location:myaccount.php');
			}
		
		} else {
			header('Location:index.php?msg=1');
		}
}
?>